﻿@using KRM.Core
@model List<KRM.Core.vOrderView_OrderItems>
@{
    var db = new KRMEntities();
}
<div class="order-items">
    <h5>Order item detail</h5>
    <div class="order-items-scroll fixhead">
        <table class="table table-hover table-bordered table-fix tbl-orderitemdetail">
            <thead>
                <tr>
                    <th>Action</th>
                    <th>Status</th>
                    <th>Quantity</th>
                    <th>ProductName</th>
                    @*<th>ProductImage</th>*@
                    <th>ProductOption</th>
                    <th>SubOptions</th>
                    <th>ProductCode</th>
                    <th>ItemPrice</th>
                    <th>Supplier</th>
                    <th>DeliveryDays</th>
                    <th>DespatchDate</th>
                    <th>Cancelled</th>
                    <th>LastSupplierConfirmation</th>
                    <th>ItemStatus</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model)
                {
                    <tr style="cursor: pointer" onclick="loaditemorderparts(@item.OrderItemID)">
                        <td>
                            <div class="btn-group">
						        <a href="#" data-toggle="dropdown" class="btn dropdown-toggle"><i class="icon-cog"></i> <span class="caret"></span></a>
						        <ul class="dropdown-menu dropdowm-right">
							        <li>
                                        <a href="javascript:;" 
                                            @{
                                                var orderItem = db.tblOrderItems.Find(item.OrderItemID);
                                                @(Html.Raw("onclick=\"PopupCenter('/rdm/" + (orderItem.IsQuestionnaire ? "addquestionnaireform" : "addquestionnairenonfac") + "?orderitemid=" + item.OrderItemID + "', 700, 640)\""))
                                            }
                                            >Create RDM</a>
							        </li>
							        <li>
								        <a href="javascript:;" onclick="PopupCenter('orderview/viewauditforaddingpart/@item.OrderItemID?orderref=@item.OrderItem.Order.OrderRef')">View Audit For Adding Part</a>
							        </li>
                                    <li>
                                        <a href="javascript:;" >Add photos</a>
                                    </li>
                                    <li>
                                        <a href="javascript:;" >View Folder</a>
                                    </li>
						        </ul>
					        </div>
                        </td>
                        <td>@item.Status</td>
                        <td>@item.Quantity</td>
                        <td>@item.Product_Name</td>
                        @*<td>@Html.Raw("<img src='" + item.ProductImage + "' width='80px' height='50px'")</td>*@
                        <td>@item.Product_Option</td>
                        <td>@item.Sub_options</td>
                        <td>@item.ProductCode</td>
                        <td>@item.Item_Price</td>
                        <td>@item.Supplier</td>
                        <td>@item.deliveryDays</td>
                        <td>@item.DespatchDate</td>
                        <td>@item.Cancelled</td>
                        <td>@item.LastSupplierConfirmation</td>
                        <td>@item.ItemStatus</td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
    <div class="row-fluid">
    <div class="span3"></div>
    <div class="span6">
        <div class="row-fluid">
            <a href="#" class="btn btn-orderitem">Change Date</a>
            <a href="#" class="btn btn-orderitem">Audit Picking A Day</a>
            <a href="#" class="btn btn-orderitem">Allocate Parts</a>
        </div>
        <div class="row-fluid">
            <a href="#" class="btn btn-orderitem">Override Change Date</a>
            <a href="#" class="btn btn-orderitem">View Sub Options</a>
            <a href="#" class="btn btn-orderitem">Assign VIP Status</a>
        </div>
    </div>
        <div class="span3">
            <a href="#" class="btn btn-danger" style="margin: 10px 0 0 10px">Cancel Order</a>
            <a href="#" class="btn btn-danger" style="margin: 10px 0 0 10px">Cancel Item</a>
        </div>
        </div>
</div>
